﻿@model Dictionary<string, object>
@{
    ViewBag.Title = "添加系统功能";
    Layout = "~/Views/Shared/_JuiLayout.cshtml";

    string hostId = MyRequest.GetQueryString("hostId");
    string className = selectControlBLL.getNameById("id", hostId, "Sys_IBKMmenuTree", "title");
    
}
@section header {}
<div id="layout" class="noNavTab">
    <div id="navTab">
        <h2 class="contentTitle">
            添加系统功能</h2>
        @{
            int id = Utils.StrToInt(ViewData["id"], 0);
            string rturl = "/SysMenu/List?menu=SysFunctions&name=list&hostId="+hostId;
            using (Html.BeginForm("Add", "OperateTotal", new { name = DencryptHelper.Encrypt("Sys_IBFunctions"), url = rturl }, FormMethod.Post, new { @class = "pageForm required-validate", onsubmit = "return validateCallback(this,navTabAjaxDone)" }))
            { 
            <div class="pageFormContent nowrap">
                <dl>
                    <dt>所属菜单：</dt>
                    <dd>
                        @Html.TextBox("MenuId", className, new { @class = "textInput", @readonly = "true", maxlength = "100" })
                        <input type="hidden" name="t0_MenuId" id="t0_MenuId" value='@hostId ' class="required" />
                    </dd>
                </dl>
                <dl>
                    <dt>编码：</dt>
                    <dd>
                        @Html.TextBox("t0_No", "", new { @class = " textInput", maxlength = "100" })
                    </dd>
                </dl>
                <dl>
                    <dt>名称：</dt>
                    <dd>
                        @Html.TextBox("t0_Name", "", new { @class = "required textInput", maxlength = "100" })
                    </dd>
                </dl>
                <dl>
                    <dt>描述：</dt>
                    <dd>
                        @Html.TextArea("t0_Description", new { @class = " textInput", rows = "5", cols = "80", maxlength = "100" })
                    </dd>
                </dl>
                <dl>
                    <dt>URL：</dt>
                    <dd>
                        @Html.TextBox("t0_Url", "", new { @class = " textInput", maxlength = "100" })
                    </dd>
                </dl>
                <dl>
                    <dt>Controller名称：</dt>
                    <dd>@Html.TextBox("t0_ControllerName", "", new { @class = " textInput", maxlength = "100" })</dd>
                </dl>
                <dl>
                    <dt>Action名称：</dt>
                    <dd>@Html.TextBox("t0_ActionName", "", new { @class = " textInput", maxlength = "100" })</dd>
                </dl>
                <dl>
                    <dt>序号：</dt>
                    <dd>
                        @Html.TextBox("t0_SortOrder", "", new { @class = "digits required textInput", maxlength = "100" })
                    </dd>
                </dl>
                <dl>
                    <dt>操作：</dt>
                    <dd>
                        <span id="show" class="">
                        </span>
                    </dd>
                </dl>
                <dl>
                    <dt>&nbsp</dt>
                    <dd>
                        @Html.TextBox("num", "", new { @class = "digits textInput", maxlength = "100" })
                        @Html.TextBox("fun", "", new { @class = " textInput", maxlength = "100" })
                        <input type="button" value="添加" id="btnAdd" onclick='add()' />
                        @Html.Hidden("t0_Operations", "");
                    </dd>
                </dl>
                <dl>
                    <dt>&nbsp</dt>
                    <dd>
                        <div class="buttonActive">
                                <div class="buttonContent">
                                    <button type="submit">
                                        添加</button></div>
                            </div>
                    </dd>
                    <dd>
                        <a class="button" href='@rturl'><span>返回</span></a></dd>
                </dl>
            </div>
            }
        }
    </div>
</div>

<link href="../../content/jui-normal.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
    var sum=0,dic = {};
    function add() {
        var num = $('#num').val(), fun = $('#fun').val();
        if (isNaN(parseInt(num, 10))) {
            return;
        }
        if (num >=0 && fun != '') {
            $('#num').val('');
            $('#fun').val('');
            var id="sp_"+sum;
            dic[id] = num + "=" + fun;
            oper();
            $('#show').append("<span id=" + id + "><em>" + dic[id] + "</em> -- <a onclick='del(\"" + id + "\")'>X</a></span>");
            sum++;
        }
    }
    function del(d) {
        $('#' + d).remove();
        dic[d] = "";
        oper();
    }
    function oper() {
        var opera = "";
        $.each(dic, function (k, v) {
            if (v != "") {
                opera = opera + v + ",";
            }
        });
        $('#t0_Operations').val(opera);
    }
</script>
